Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MML #1429: MegaMek side of fix for MML NPE in Aero Equipment tab #5176

Merged

Conversation

Sleet01
Copy link
Collaborator

@Sleet01 Sleet01 commented Feb 18, 2024

This is the MM fix for MegaMek/megameklab#1429; what I thought was a guard check against weapon being null was actually a form of overloading that's used exclusively by the megameklab UI to select AV range bands when displaying equipment.

I've created a bare getter that returns the value that UI builder needs, and added a check to call it if the weapon passed to wtype.getRanges() is null.

Testing:

  • Re-ran existing MM unit tests.
  • Tested all Aerospace subclasses in MML

I'd like to add a unit test to MegaMekLab to make sure that this doesn't regress but I need some help on that, so for now this should be sufficient.

Close MegaMek/megameklab#1429

Copy link
Member

@SJuliez SJuliez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also the possibility that weapon.getlinked() is null. I assume the method isn't called in that case.

@Sleet01
Copy link
Collaborator Author

Sleet01 commented Feb 18, 2024

There is also the possibility that weapon.getlinked() is null. I assume the method isn't called in that case.

In that case the base maxRange value is returned.

@SJuliez SJuliez merged commit 6c8888b into MegaMek:master Feb 20, 2024
4 checks passed
@metalconscript
Copy link

I have the NPE but I am unsure how to apply the fix for the dropship/small craft equipment tab. Please advise, thank you.

@Sleet01
Copy link
Collaborator Author

Sleet01 commented Feb 29, 2024

I have the NPE but I am unsure how to apply the fix for the dropship/small craft equipment tab. Please advise, thank you.

The fix is checked in to the development branch, so your options as of right now are:

  1. download the latest nightly build and play on the bleeding edge of alpha code,
  2. wait until 0.49.19 is released.

If you decide to go with option 1, please come over to the MegaMek discord so we can help get you up and running; it's not quite as easy as playing with the current release version (from what I recall).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE: Cannot invoke "megamek.common.Mounted.getLinked()" because "weapon" is null
3 participants